<template>
	<view>

		<view class="item">

			<view style="display: inline-flex; height: 80rpx; justify-content: space-between; margin: 0 20rpx;">
				<u-icon name="order" color="#1573FF" label="渠道商信息" label-color="#333333"
					:customStyle="{'line-height': '80rpx',}">
				</u-icon>

			</view>


			<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>

			<view>
				<view class="text-line">
					<text class="text-name">渠道名称:</text>
					<text class="text-value">{{dataBean.channelName|filterNull}}</text>
				</view>

<!--				<view class="text-line">-->
<!--					<text class="text-name">法人名称:</text>-->
<!--					<text class="text-value">{{dataBean.corp|filterNull}}</text>-->
<!--				</view>-->

				<view class="text-line">
					<text class="text-name">身份证号:</text>
					<text class="text-value">{{dataBean.cardNo|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">详细地址:</text>
					<text class="text-value">{{dataBean.addrDetail|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">银行卡号:</text>
					<text class="text-value">{{dataBean.bankCardNo|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">联系人:</text>
					<text class="text-value">{{dataBean.contacts|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">联系电话:</text>
					<text class="text-value">{{dataBean.phone|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">业务员:</text>
					<text class="text-value">{{dataBean.salesmanName|filterNull}}</text>
				</view>

				<view class="text-line">
					<text class="text-name">合作状态:</text>
					<text class="text-value">{{
              1==dataBean.consociationStatus?'合作中':
              2==dataBean.consociationStatus?'已解除合作':
              3==dataBean.consociationStatus?'合作申请中':
              4==dataBean.consociationStatus?'取消合作':'--'
            }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">账单类型:</text>
					<text class="text-value">{{
              0==dataBean.billType?'无':
              1==dataBean.billType?'自然月计算':
              2==dataBean.billType?'自然月计算（可以配置）':
              3==dataBean.billType?'固定30日':
              4==dataBean.billType?'满月计算':'--'
            }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">渠道类型:</text>
					<text class="text-value">{{1==dataBean.chlType?'企业':2==dataBean.chlType?'个人':'--'}}</text>
				</view>

			</view>

		</view>

		<view class="item">

			<view style="display: inline-flex; height: 80rpx; justify-content: space-between; margin: 0 20rpx;">
				<u-icon name="order" color="#1573FF" label="其他信息" label-color="#333333"
					:customStyle="{'line-height': '80rpx',}">
				</u-icon>

			</view>

			<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>

			<view>
				<view class="text-line">
					<text class="text-name">身份证照片:</text>
					<text class="text-value" v-if="dataBean.idCardImg==null">--</text>
				</view>
        <image @click="preview(dataBean.idCardImg)" class="idcard" :src="dataBean.idCardImg|mmvImageUrl" mode="scaleToFill"></image>

				<view class="text-line">
					<text class="text-name">银行卡照片:</text>
					<text class="text-value" v-if="dataBean.bankCardImg==null">--</text>
				</view>
        <image @click="preview(dataBean.bankCardImg)" class="idcard" :src="dataBean.bankCardImg|mmvImageUrl" mode="scaleToFill"></image>

				<view class="text-line">
					<text class="text-name">渠道附件:</text>
					<text class="text-value" v-if="dataBean.fjList==null || dataBean.fjList.length<=0">--</text>
				</view>

<!--				<view class="text-line" v-if="dataBean.fjList && dataBean.fjList.length>0">-->
<!--          -->
<!--          -->
<!--					<u-album :urls="dataBean.fjList" keyName="url"></u-album>-->
<!--				</view>-->

        <picPdf v-if="dataBean.fjList && dataBean.fjList.length>0" :attachment="dataBean.fjList"></picPdf>
				
				
			</view>

		</view>
		
		<view style="height: 100rpx;"></view>
		
		<view class="button-container">
			<button class="btn-item" @click="bottomClick">编辑</button>
		</view>


	</view>
</template>

<script>
	import remindCarinfo from '../../components/remind-carinfo.vue';
  import picPdf from "@/components/pic-pdf.vue";
  import {mmvImageUrl} from "@/common/filters";

	export default {
		components: {
      picPdf,
			remindCarinfo,
		},

		data() {
			return {
				dataBean: {
					yyzzFileList:[],
					frsfFileList:[],
					fjList:[],
					
				},
				id: '',
			}
		},
		methods: {
      mmvImageUrl,
			bottomClick() {
				uni.navigateTo({
					url:'/pagesA/channel/addchannel?id='+this.id
				})
			},

      preview(url){
        let that = this
        uni.previewImage({
          urls:[that.baseImgUrl() + url]
        })
      },
			
			getData(){
				let that = this
				
				this.$u.api.channelDetail(this.id).then(
				
					res => {
						that.dataBean = res;
						
						// that.dataBean.fjList = that.dataBean.fjList.filter(item => {
						// 	if ('1' == item.typeFile || '1'==item.type_file) {
						// 		item.url = that.baseImgUrl() + item.url;
						// 		return item;
						// 	}
						// })
						//
						// that.dataBean.yyzzFileList = that.dataBean.yyzzFileList.filter(item => {
						// 	if ('1' == item.typeFile || '1'==item.type_file) {
						// 		item.url = that.baseImgUrl() + item.url;
						// 		return item;
						// 	}
						// })
						//
						// that.dataBean.frsfFileList = that.dataBean.frsfFileList.filter(item => {
						// 	if ('1' == item.typeFile || '1'==item.type_file) {
						// 		item.url = that.baseImgUrl() + item.url;
						// 		return item;
						// 	}
						// })
						//
						//
						//
						// console.log('附件list=>', that.dataBean.fjList);
						
					}
				);
			}
		},

		onLoad(op) {
			this.id = op.id;
			
			let that = this
			
			uni.$on('addchannel', res=>{
				that.getData();
			})

			this.getData()
			
			
		}
	}
</script>

<style lang="scss" scoped>
	.btn-detail {
		width: 180rpx;
		height: 60rpx;
		border-radius: 50rpx;
		color: white;
		text-align: center;
		background-color: $blue15;
		font-size: 26rpx;
		line-height: 60rpx;
		align-self: flex-end;
		margin: 10rpx 20rpx 10rpx;
	}

	.nodata {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		image {
			width: 200rpx;
			height: 100rpx;
		}

		text {
			margin-top: 35rpx;
			margin-bottom: 60rpx;
			font-size: 24rpx;
			color: #C5D3E8;
		}
	}

  .idcard{
    width: 380rpx;
    height: 200rpx;
    margin-left: 30rpx;
  }

</style>
